@use 'sass:map';
@import 'mixins/overwrite';

@include b(image) {
  position: relative;
  display: inline-flex;
  vertical-align: top;

  &:hover {
    @include e(actions) {
      opacity: 1;
    }
  }

  @include e(actions) {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--#{$rd-prefix}background-color-actions-mask);
    opacity: 0;
    transition: opacity var(--#{$rd-prefix}animation-duration-base) linear;
  }

  @include e(action) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    font: inherit;
    color: #{map.get($rd-colors, 'white')};
    vertical-align: top;
    cursor: pointer;
    background-color: transparent;
    border: none;
    outline: none;
    transition: background-color var(--#{$rd-prefix}animation-duration-base) linear;
    appearance: none;

    &:hover,
    &:focus {
      background-color: var(--#{$rd-prefix}background-color-light-hover);
    }

    &:disabled {
      pointer-events: none;
      filter: opacity(50%);
    }
  }
}

@include b(image-preview) {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  padding: 68px 68px 98px;
  overflow: hidden;
  outline: none;

  @include e(navigation-button) {
    @include utils-button;

    position: absolute;
    z-index: 5;
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    /* stylelint-disable-next-line declaration-property-value-allowed-list */
    font-size: 18px;
    color: var(--#{$rd-prefix}text-color);
    background-color: var(--#{$rd-prefix}background-color);
    border: none;
    border-radius: 50%;
    box-shadow: 0 1px 4px 0 var(--#{$rd-prefix}shadow-color);
    transition: color var(--#{$rd-prefix}animation-duration-base) linear,
      background-color var(--#{$rd-prefix}animation-duration-base) linear;

    &:hover {
      color: var(--#{$rd-prefix}color-primary);
      background-color: var(--#{$rd-prefix}background-color-gray);
    }

    @include m(prev) {
      top: 50%;
      left: 12px;
      transform: translateY(-50%);
    }

    @include m(next) {
      top: 50%;
      right: 12px;
      transform: translateY(-50%);
    }
  }

  @include e(toolbar) {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    width: 100%;
    height: 48px;
    padding: 0 10px;
    margin: 0;
    list-style: none;
    background-color: var(--#{$rd-prefix}background-color);
  }

  @include e(toolbar-page) {
    @include polyfill-column-gap(8px);

    display: inline-flex;
    align-items: center;
    margin-right: auto;
  }

  @include e(toolbar-page-input) {
    @include overwrite-component(input) {
      width: 60px;
    }
  }

  @include e(toolbar-rotate) {
    margin-right: 10px;
  }

  @include e(toolbar-zoom-input) {
    @include overwrite-component(input) {
      width: 80px;
      margin: 0 4px;
    }
  }

  @include e(toolbar-close) {
    margin-left: 10px;
  }

  @include e(img) {
    z-index: 1;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: move;
    user-select: none;
    outline: none;
    object-fit: contain;
  }

  @include e(thumbnail-list) {
    @include polyfill-column-gap(8px);

    position: absolute;
    bottom: 10px;
    left: 50%;
    z-index: 5;
    display: flex;
    padding: 8px;
    margin: 0;
    list-style: none;
    background-color: var(--#{$rd-prefix}background-color);
    /* stylelint-disable-next-line declaration-property-value-allowed-list */
    border-radius: 8px;
    transform: translateX(-50%);
  }

  @include e(thumbnail) {
    width: 52px;
    height: 52px;
    cursor: pointer;
    background-color: var(--#{$rd-prefix}background-color-hover);
    border: 1px solid transparent;
    transition: border-color var(--#{$rd-prefix}animation-duration-base) linear;

    &:hover {
      border-color: var(--#{$rd-prefix}color-primary-lighter);
    }

    @include when(active) {
      border-color: var(--#{$rd-prefix}color-primary);
    }
  }

  @include e(thumbnail-img) {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}
